﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:effects="clr-namespace:BrokenHouse.Windows.Parts.Transition.Effects"
                    xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
                    xmlns:local="clr-namespace:BrokenHouse.Windows.Parts.Transition"
                    xmlns:primitives="clr-namespace:BrokenHouse.Windows.Parts.Transition.Primitives">

   
    <Style x:Key="STYLE_AtStart" TargetType="{x:Type local:TransitionFrame}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TransitionFrame}">
                    <ContentPresenter Content="{TemplateBinding Content}"
                                      ContentTemplate="{TemplateBinding ContentTemplate}"
                                      ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}">
                        <ContentPresenter.OpacityMask>
                            <DrawingBrush ViewboxUnits="Absolute" Viewbox="0,0,1,1"  ViewportUnits="RelativeToBoundingBox">
                                <DrawingBrush.Drawing>
                                    <GeometryDrawing Brush="White">
                                        <GeometryDrawing.Geometry>
                                            <GeometryGroup>
                                                <RectangleGeometry x:Name="PART_Rect" Rect="-0.25,-0.25,0,1.50">
                                                    <RectangleGeometry.Transform>
                                                        <RotateTransform x:Name="PART_Rotate" CenterX="0.5" CenterY="0.5"
                                                                         Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TransitionEffect.Angle}"/>
                                                    </RectangleGeometry.Transform>
                                                </RectangleGeometry>
                                            </GeometryGroup>
                                        </GeometryDrawing.Geometry>
                                    </GeometryDrawing>
                                </DrawingBrush.Drawing>
                            </DrawingBrush>
                        </ContentPresenter.OpacityMask>
                    </ContentPresenter>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="STYLE_AtCenter" TargetType="{x:Type local:TransitionFrame}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TransitionFrame}">
                    <ContentPresenter Content="{TemplateBinding Content}"
                                      ContentTemplate="{TemplateBinding ContentTemplate}"
                                      ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}">
                        <ContentPresenter.OpacityMask>
                            <DrawingBrush ViewboxUnits="Absolute" Viewbox="0,0,1,1"  ViewportUnits="RelativeToBoundingBox">
                                <DrawingBrush.Drawing>
                                    <GeometryDrawing Brush="White">
                                        <GeometryDrawing.Geometry>
                                            <GeometryGroup>
                                                <RectangleGeometry x:Name="PART_Rect" Rect="-0.25,-0.25,1.50,1.50">
                                                    <RectangleGeometry.Transform>
                                                        <RotateTransform x:Name="PART_Rotate" CenterX="0.5" CenterY="0.5"
                                                                         Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TransitionEffect.Angle}"/>
                                                    </RectangleGeometry.Transform>
                                                </RectangleGeometry>
                                            </GeometryGroup>
                                        </GeometryDrawing.Geometry>
                                    </GeometryDrawing>
                                </DrawingBrush.Drawing>
                            </DrawingBrush>
                        </ContentPresenter.OpacityMask>
                    </ContentPresenter>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="STYLE_AtEnd" TargetType="{x:Type local:TransitionFrame}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TransitionFrame}">
                    <ContentPresenter Content="{TemplateBinding Content}"
                                      ContentTemplate="{TemplateBinding ContentTemplate}"
                                      ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}">
                        <ContentPresenter.OpacityMask>
                            <DrawingBrush ViewboxUnits="Absolute" Viewbox="0,0,1,1"  ViewportUnits="RelativeToBoundingBox">
                                <DrawingBrush.Drawing>
                                    <GeometryDrawing Brush="White">
                                        <GeometryDrawing.Geometry>
                                            <GeometryGroup>
                                                <RectangleGeometry x:Name="PART_Rect" Rect="1.25,-0.25,0.0,1.50">
                                                    <RectangleGeometry.Transform>
                                                        <RotateTransform x:Name="PART_Rotate" CenterX="0.5" CenterY="0.5"
                                                                         Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TransitionEffect.Angle}"/>
                                                    </RectangleGeometry.Transform>
                                                </RectangleGeometry>
                                            </GeometryGroup>
                                        </GeometryDrawing.Geometry>
                                    </GeometryDrawing>
                                </DrawingBrush.Drawing>
                            </DrawingBrush>
                        </ContentPresenter.OpacityMask>
                    </ContentPresenter>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Storyboard x:Key="TRANS_StartToCenter">
        <RectAnimation Storyboard.TargetName="PART_Rect" Storyboard.TargetProperty="Rect" From="-0.25,-0.25,0,1.50" To="-0.25,-0.25,1.50,1.50" Duration="0:0:1" />
    </Storyboard>

    <Storyboard x:Key="TRANS_CenterToStart">
        <RectAnimation Storyboard.TargetName="PART_Rect" Storyboard.TargetProperty="Rect" From="-0.25,-0.25,1.50,1.50" To="-0.25,-0.25,0,1.50" Duration="0:0:1"/>
    </Storyboard>

    <Storyboard x:Key="TRANS_CenterToEnd">
        <RectAnimation Storyboard.TargetName="PART_Rect" Storyboard.TargetProperty="Rect" From="-0.25,-0.25,1.50,1.50" To="1.25,-0.25,0.0,1.50" Duration="0:0:1"/>
    </Storyboard>
    
    <Storyboard x:Key="TRANS_EndToCenter">
        <RectAnimation Storyboard.TargetName="PART_Rect" Storyboard.TargetProperty="Rect" From="1.25,-0.25,0.0,1.50" To="-0.25,-0.25,1.50,1.50" Duration="0:0:1"/>
    </Storyboard>
</ResourceDictionary>